using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Catchbase.TestTools.UTest
{
    [TestClass]
    public class ReflectionsTest
    {
        [TestMethod]
        public void CtorParams_MustReturnAllParameterTypesOfLargestPublicCtor()
        {
            var parameters = typeof (ReflectionHelperTestHelperClass).CtorParams().ToList();
            parameters.MustContainExactObjects(typeof(string));
        }

        [TestMethod]
        public void CreateInstance_MustCreateInstance_WhenEmptyCtorExists()
        {
            var type = typeof (ReflectionHelperTestHelperClass);
            type.CreateInstance().MustBeInstanceOf(type);
        }

        [TestMethod]
        public void CreateInstanceOfT()
        {
            var result = typeof (ReflectionHelperTestHelperClass).CreateInstance<ReflectionHelperTestHelperClass>();
            result.MustBeInstanceOf(typeof(ReflectionHelperTestHelperClass));
        }

        public class ReflectionHelperTestHelperClass
        {
            public ReflectionHelperTestHelperClass(){}
            public ReflectionHelperTestHelperClass(String s){}
            protected ReflectionHelperTestHelperClass(String s, Object o){}
        }
    }
}